package com.design.patterns.structuralModel.state;

import com.design.patterns.structuralModel.state.service.elevator.ClosingState;
import com.design.patterns.structuralModel.state.service.Context;
import com.design.patterns.structuralModel.state.service.elevator.RunningState;

/**
 * 状态模式
 * 目的：许一个对象在其内部状态改变时改变它的行为。对象看起来似乎修改了它的类。
 *
 */
public class StateMain {
    public static void main(String[] args) {
        Context context = new Context();
        context.setBaseState(new ClosingState());
        context.run().open().close();

        Context context1 = new Context();
        context1.setBaseState(new RunningState());
        context1.stop().open().run().open();

    }
}
